<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">
		<!-- 引入组件 -->
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vant@1.6/lib/vant.min.js"></script>
		<script src="../js/ajax.js"></script>
		<script src="html5plus://ready"></script>
		<script type="text/javascript" src="../js/back.js"></script>
		<script type="text/javascript" src="../js/back1.js"></script>
	</head>
	<body>
		<div id="app">
			<van-nav-bar title="注册用户"  @click-left="onback1" left-arrow>
			</van-nav-bar>
			<van-cell-group>
				<van-field v-model="phone" placeholder="手机号码" />
			</van-cell-group>
			<van-cell-group>
				<van-field v-model="Code" center clearable placeholder="验证码(6位数字短信验证码)">
					<van-button slot="button" size="small" type="danger" @click="Huoqu(13140577217)">获取验证码</van-button>
				</van-field>
			</van-cell-group>
			<van-cell-group>
				<van-field v-model="password" placeholder="登录密码(最少6位)" />
			</van-cell-group>
			<van-cell-group>
				<van-field v-model="newpwd" placeholder="确认密码(再次输入登录密码)" />
			</van-cell-group>
			<van-cell-group>
				<van-field v-model="name" placeholder="昵称(最多20个字)" />
			</van-cell-group>
			<van-cell-group>
				<van-field v-model="districtCode" placeholder="身份证前六位" />
			</van-cell-group>
			<van-cell-group>
				<van-cell>
					<van-button size="large" hairline>注册会员表示同意《万众雅讯用户注册协议》</van-button>
				</van-cell>
			</van-cell-group>
			<van-cell-group>
				<van-cell @click="getRegister">
					<van-button size="large" type="danger">立即注册</van-button>
				</van-cell>
			</van-cell-group>
		</div>
		<script>
			var vm = new Vue({
				el: "#app",
				data: {
					phone: "",
					Code: "",
					password: "",
					newpwd: "",
					name: "",
					address: "",
					districtCode:"",
				},
				methods: {
					Huoqu: function() {
						var _this = this;
						ajax({
							url: "http://dsapi.ysd3g.com/API/SendRegisterPhoneCode",
							data:{phone:_this.phone},
							dataType: "jsonp",
							success: function(res) {
								_this.Code = res.Code;
								alert(res.Code)
							}
						})
					},
					getRegister:function(){
						var _this = this;
						ajax({
							url: "http://dsapi.ysd3g.com/API/UserRegister",
							data:{phone:_this.phone,Code:_this.Code,password:_this.password,nickName:_this.name,districtCode:_this.districtCode },
							dataType: "jsonp",
							success: function(res) {
								alert("注册成功");
								plus.webview.create("Login.html","login").show()
							}
						})
					},
					onback1: function() {
						plus.webview.close(plus.webview.currentWebview().id);
					},
				}
			})
		</script>
	</body>
</html>
